package com.weiz.web;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class TestController {

    @GetMapping(value = {"/"})
    public String index(){
        return "index";
    }

    @GetMapping(value = "hello")
    public String hello(){
        return "hello";
    }

    @GetMapping(value = "login")
    public String login(){
        return "login";
    }

    @GetMapping(value = "admin")
    public String admin(Model model){
        model.addAttribute("extraInfo","当前登录用户为管理员权限");
        return "admin";
    }

    @PreAuthorize("hasAuthority('sys-user-mgr-add')")
    @GetMapping(value = "adminAdd")
    public String adminAdd(){
        return "admin-add";
    }
}
